// SysInit Unit
// Modular Support - EXE

(*************)
(* Interface *)
(*************)
{$IFDEF Include_Modules_Header}

 Procedure _InitExe(Const ModuleInfo: TModuleInfo);

{$ENDIF Include_Modules_Header}
(******************)
(* Implementation *)
(******************)
{$IFDEF Include_Modules_Implement}

 Procedure _InitExe(Const ModuleInfo: TModuleInfo);
  BEGIN
   System._RTL_FirstChanceInit;

   TLSIndex:= 0; // Executable gets implicit TLS slot 0

   _INT_ModuleType:= mtExe;
   _INT_HInstance:= _WIN_GetModuleHandle(NIL);

   _INT_Module.Instance:= _INT_HInstance;
   _INT_Module.ModuleInfo:= @ModuleInfo;

   _INT_InitExtensionStore;
   _INT_InitProcessTLS;
   System._RTL_TLSProcs(_INT_InitThreadTLS, _INT_ExitThreadTLS, _INT_ExitProcessTLS);

   System._RTL_PrepareExe(@_INT_Module);
   System.RegisterModule(@_INT_Module);
   System.ModuleInit(@_INT_Module);
  END;

{$ENDIF Include_Modules_Implement}

